#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cstring>
#define endl "\n"
using namespace std;
int main()
{
	int dp[30] = { 0 }, a[30] = { 0 },y=0;
	int n[5] = { 0 };
	cin >> n[1] >> n[2] >> n[3] >> n[4];
	for (int i = 1; i <= 4; i++)
	{
		for (int j = 1; j <= n[i]; j++)
		{
			cin >> a[j];
		}
		memset(dp, 0, sizeof(dp));
		dp[1] = a[1],dp[2]=a[2];
		for (int k = 3; k <= n[i]; k++)
		{
			dp[k] = min(dp[k - 1], dp[k - 2]) + a[k];
			dp[k - 1] = max(dp[k - 1], dp[k - 2]);
		}
		y = y + max(dp[n[i]],dp[n[i-1]]);
	}
	cout << y << endl;
	return 0;

}